
@extends('layouts.back_stage')
@section('content')
    <style>
        @media print {
            .TreeTable {display: block !important;}
            .p1Info,.p2Info{display: block !important;}
            .h3Info{display: block !important;}
        }
        @media screen {
            .TreeTable {display: none !important;}
            .p1Info,.p2Info{display: none !important;}
            .h3Info{display: none !important;}
        }
        ::-webkit-scrollbar {height: 8px;}
        .el-table__footer-wrapper tbody td, .el-table__header-wrapper tbody td{color:red;}
        .shopBg{background:#fff;overflow: hidden;margin:20px 0 10px 0;}
        .input-item{width:180px;padding-right: 0;margin-right:10px;}
        .tableBg{padding:30px;background:#fff;margin-top:10px;}
        .pagination-box{text-align: center;box-sizing:border-box;margin-top:20px;}
        .el-range-editor--small.el-input__inner{width:300px;}
        .el-date-editor .el-range-separator{padding:0 15px}
        .el-table--mini th{padding:0;}
        .demo-table-expand {font-size: 0;width: 100%;}
        .demo-table-expand label {width: 90px;color: #99a9bf;}
        .demo-table-expand .formItem1 {margin-right: 0;margin-bottom: 0;width: 100%;}
        .demo-table-expand .formItem2 {margin-right: 0;margin-bottom: 0;width: 96%;margin-left: 4%;}
        .el-checkbox+.el-checkbox{margin-left:0;}
        .el-table__expanded-cell[class*=cell]{padding: 10px 50px;}
        .el-form-item__content{line-height: 25px;}
        .el-checkbox__label{font-size:12px;}

        .touching{float:right;margin-right:30px;}
        .el-button+.el-button.picking{float:right;margin-right:15px;margin-left:0;}

        .el-table__expanded-cell[class*=cell]{padding:0 !important;}
        .el-table .divBg{padding:10px 50px;}
        .demo-table-expand {font-size: 0;}
        .demo-table-expand label {width: 90px;color: #606266;line-height:30px;font-size: 12px;}
        .demo-table-expand .el-form-item__content{line-height:30px;font-size: 12px;}
        .demo-table-expand .el-form-item {margin-right: 0;margin-bottom: 0;width: 25%;}

        .el-table tr:hover>td{background:initial !important;}
        .el-table tr.current-row>td{background:initial !important;}
        .el-table--striped .el-table__body tr.el-table__row--striped.current-row td, .el-table__body tr.current-row>td, .el-table__body tr.hover-row.current-row>td, .el-table__body tr.hover-row.el-table__row--striped.current-row>td, .el-table__body tr.hover-row.el-table__row--striped>td, .el-table__body tr.hover-row>td{background:initial !important;}

        .el-table .bgBlue {background: #7ccafa;}
        .el-table .bgred{background:#e99f96;}
        .el-select .el-input .el-select__caret.el-input__icon{line-height:22px;}
        .borderBg .el-table::before{height:0 !important;}
        /*汇总*/
        .huiRow{float:left;width:33.3333%;height:70px;line-height:70px;text-align:center;border-right:1px solid #6C6A6C;}
        .huiRow label,.huiRow .laDiv{height:35px;line-height:35px;float:left;width: 100%;font-size:16px;}

        .spTip{width:20px;height:20px;display:inline-block;margin:0 5px 0 20px;}
        [v-cloak] {display: none;}
        .tb-edit .el-input {display: none}
        .tb-edit .current-row .el-input {display: block}
        .tb-edit .current-row .el-input+span {display: none}
        .tb-edit .el-input--small .el-input__inner{line-height:22px;height:22px;padding:0 !important;text-align: center !important;color: #1aad1a !important;}
    </style>
    <div class="container">
        <div style="padding:20px 20px 20px 0;overflow:hidden;"><h3 style="float:left;">退货申请单列表</h3></div>
        <!-- 主体-->
        <div class="page-body">
            <div class="row app" id="guanLi" v-loading="loading" v-cloak>
                <el-button type="primary" class="touching" size="small" @click="zhuanCard">转退货单</el-button>
                <el-button type="primary" class="picking" size="small" @click="boHui">驳回</el-button>
                <el-button type="primary" class="picking" size="small" @click="versa">反审</el-button>
                <el-button type="primary" class="picking" size="small" @click="auditCard">审核</el-button>
                <el-button type="primary" class="picking" size="small" @click="offMake">反确认</el-button>
                <el-button type="primary" class="picking" size="small" @click="sureMake">确认制单</el-button>
                <el-button type="primary" class="picking" size="small" @click="touching">制单</el-button>
                <div class="col-md-12 row row-table-box">
                    <div class="shopBg">
                        <div class="row" style="margin-top:10px;padding:9px 30px;background:#fff;">
                            <label>单据号：</label>
                            <el-input v-model.trim="order_num" class="input-item" placeholder="请输入单据号" size="small" prefix-icon="el-icon-search" clearable></el-input>
                            <label>款号：</label>
                            <el-input v-model.trim="girard" class="input-item" placeholder="请输入款号" size="small" prefix-icon="el-icon-search" clearable></el-input>
                            <label>客户：</label>
                            <el-input v-model.trim="customer" class="input-item" placeholder="请输入客户" size="small" prefix-icon="el-icon-search" clearable></el-input>
                            <el-button type="primary" size="small" @click="grabble('reset')">搜索</el-button>
                            <el-button type="primary" @click="resetFrom()" size="small">重置</el-button>
                        </div>
                    </div>
                    <div class="shopBg" style="margin-top:10px;padding:15px 30px;height:100px;background:#fff;">
                        <div class="huiRow">
                            <label>退货数量/件</label>
                            <div class="laDiv">@{{ total_nums }}</div>
                        </div>
                        <div class="huiRow">
                            <label>已转单数/件</label>
                            <div class="laDiv">@{{ turn_nums }}</div>
                        </div>
                        <div class="huiRow" style="border-right:none;">
                            <label>总金额/元</label>
                            <div class="laDiv">@{{ total_price }}</div>
                        </div>
                    </div>
                    <div class="tableBg borderBg">
                        <p style="height:20px;line-height:20px;display: inline-flex;float: right;">
                            <span class="spTip" style="background:#7ccafa;"></span>已确认制单
                            <span class="spTip" style="background:#e99f96;"></span>已审核
                        </p>
                        <el-table :data="tableInfo" max-height="510" size="mini" style="width: 100%;" @row-click="rowClick" @filter-change="filterChange" tooltip-effect="dark" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" >
                            <el-table-column type="expand">
                                <template slot-scope="scope">
                                    <div v-if="scope.row.bgColor===''" class="divBg">
                                        <el-form label-position="left" inline class="demo-table-expand">
                                            <el-form-item label="制单日期:"><span>@{{ scope.row.created_at }}</span></el-form-item>
                                            <el-form-item label="制单人:"><span>@{{ scope.row.founder }}</span></el-form-item>
                                            <el-form-item label="审核时间:"><span>@{{ scope.row.check_time }}</span></el-form-item>
                                            <el-form-item label="审核人:"><span>@{{ scope.row.checker }}</span></el-form-item>
                                            <el-form-item label="确认时间:"><span>@{{ scope.row.ack_time }}</span></el-form-item>
                                            <el-form-item label="确认人:"><span>@{{ scope.row.acker }}</span></el-form-item>
                                            <el-form-item label="修改时间:"><span>@{{ scope.row.last_modified_time }}</span></el-form-item>
                                            <el-form-item label="修改人:"><span>@{{ scope.row.last_modified }}</span></el-form-item>
                                            <el-form-item style="width:100%;" label="备注:"><span>@{{ scope.row.remark }}</span></el-form-item>
                                        </el-form>
                                    </div>
                                    <div v-if="scope.row.bgColor==='bgBlue'" class="bgBlue divBg">
                                        <el-form label-position="left" inline class="demo-table-expand">
                                            <el-form-item label="制单日期:"><span>@{{ scope.row.created_at }}</span></el-form-item>
                                            <el-form-item label="制单人:"><span>@{{ scope.row.founder }}</span></el-form-item>
                                            <el-form-item label="审核时间:"><span>@{{ scope.row.check_time }}</span></el-form-item>
                                            <el-form-item label="审核人:"><span>@{{ scope.row.checker }}</span></el-form-item>
                                            <el-form-item label="确认时间:"><span>@{{ scope.row.ack_time }}</span></el-form-item>
                                            <el-form-item label="确认人:"><span>@{{ scope.row.acker }}</span></el-form-item>
                                            <el-form-item label="修改时间:"><span>@{{ scope.row.last_modified_time }}</span></el-form-item>
                                            <el-form-item label="修改人:"><span>@{{ scope.row.last_modified }}</span></el-form-item>
                                            <el-form-item style="width:100%;" label="备注:"><span>@{{ scope.row.remark }}</span></el-form-item>
                                        </el-form>
                                    </div>
                                    <div v-if="scope.row.bgColor==='bgred'" class="bgred divBg">
                                        <el-form label-position="left" inline class="demo-table-expand">
                                            <el-form-item label="制单日期:"><span>@{{ scope.row.created_at }}</span></el-form-item>
                                            <el-form-item label="制单人:"><span>@{{ scope.row.founder }}</span></el-form-item>
                                            <el-form-item label="审核时间:"><span>@{{ scope.row.check_time }}</span></el-form-item>
                                            <el-form-item label="审核人:"><span>@{{ scope.row.checker }}</span></el-form-item>
                                            <el-form-item label="确认时间:"><span>@{{ scope.row.ack_time }}</span></el-form-item>
                                            <el-form-item label="确认人:"><span>@{{ scope.row.acker }}</span></el-form-item>
                                            <el-form-item label="修改时间:"><span>@{{ scope.row.last_modified_time }}</span></el-form-item>
                                            <el-form-item label="修改人:"><span>@{{ scope.row.last_modified }}</span></el-form-item>
                                            <el-form-item style="width:100%;" label="备注:"><span>@{{ scope.row.remark }}</span></el-form-item>
                                        </el-form>
                                    </div>
                                </template>
                            </el-table-column>
                            <el-table-column type="selection" width="55"></el-table-column>
                            <el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>
                            <el-table-column prop="order_num" label="单据号" min-width="135" :resizable='false'></el-table-column>
                            <el-table-column prop="customer" label="客户" min-width="150" :resizable='false'></el-table-column>
                            <el-table-column prop="nums" label="退货数量/件" min-width="100" :resizable='false'></el-table-column>
                            <el-table-column prop="turn_nums" label="已转单数" min-width="100" :resizable='false'></el-table-column>
                            <el-table-column prop="total_price" label="总金额/元" min-width="100" align="right" :resizable='false'></el-table-column>
                            <el-table-column prop="status" label="审核状态" min-width="90" :resizable='false' column-key="status" :filters="[{ text: '未审核', value: '1' }, { text: '已审核', value: '2' }]">
                                <template slot-scope="scope">
                                    <span v-if="scope.row.status===1">未审核</span>
                                    <span v-if="scope.row.status===2">已审核</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="is_ack" label="单据运行状态" min-width="110" :resizable='false' column-key="is_ack" :filters="[{ text: '未确认制单', value: '0' }, { text: '已确认制单', value: '1' }]">
                                <template slot-scope="scope">
                                    <span v-if="scope.row.is_ack===0">未确认制单</span>
                                    <span v-if="scope.row.is_ack===1">已确认制单</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="sale_season" label="销售季节" min-width="120" :resizable='false' column-key="sale_season" :filters="season_type"></el-table-column>
                            <el-table-column prop="type" label="退货单去向" min-width="110" :resizable='false' column-key="type" :filters="[{ text: '向上级提交', value: '1' }, { text: '下级提交', value: '-1' }]">
                                <template slot-scope="scope">
                                    <span v-if="scope.row.type===1">向上级提交</span>
                                    <span v-if="scope.row.type===-1">下级提交</span>
                                </template>
                            </el-table-column>
                            <el-table-column label="操作" fixed="right" width="100">
                                <template slot-scope="scope">
                                    <div v-if="scope.row.del_auth===-1">
                                        <el-button type="text" size="small" @click="lookDis(scope)">查看</el-button>
                                    </div>
                                    <div v-else>
                                        <el-button v-if="scope.row.is_ack===0" type="text" size="small" @click="editDis(scope)">修改</el-button>
                                        <el-button v-if="scope.row.status===2 || scope.row.is_ack===1" type="text" size="small" @click="lookDis(scope)">查看</el-button>
                                        <el-button v-if="scope.row.status===1 && scope.row.is_ack===0" type="text" size="small" @click="delDis(scope)">删除</el-button>
                                    </div>
                                </template>
                            </el-table-column>
                        </el-table>
                        <div class="pagination-box"><el-pagination @size-change="handleSizeChange" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip" :current-page.sync="currentPage" :total="total" layout="sizes,prev, pager, next" background></el-pagination></div>
                    </div>

                    <div class="tableBg">
                        <el-table :data="tbInfo" size="mini" border style="margin-top:20px;" :span-method="SpanMethod" max-height="565">
                            <el-table-column prop="girard" label="款号" min-width="90" :resizable='false'></el-table-column>
                            <el-table-column prop="color" label="颜色" min-width="80" :resizable='false'></el-table-column>
                            <el-table-column prop="type" label="类别" min-width="90" :resizable='false'></el-table-column>

                            <el-table-column v-for="item in sizeGr"  :label="item.key76" width="70" :resizable='false'>
                                <el-table-column :label="item.key75" width="70" :resizable='false'>
                                    <el-table-column :label="item.key79" width="70" :resizable='false'>
                                        <el-table-column :label="item.key77" width="70" :resizable='false'>
                                            <el-table-column :prop="item.key_0" :label="item.key140" width="70" :resizable='false'></el-table-column>
                                        </el-table-column>
                                    </el-table-column>
                                </el-table-column>
                            </el-table-column>

                            <el-table-column prop="count" label="合计/件" width="70" :resizable='false'></el-table-column>
                            <el-table-column prop="price" label="吊牌价/元" align="right" width="120" :resizable='false'></el-table-column>
                            <el-table-column prop="cardCount" label="吊牌金额/元" align="right" width="130" :resizable='false'></el-table-column>
                        </el-table>
                    </div>
                </div>
                <el-dialog title="退货申请单信息" :visible.sync="showBox" class="add-box" width="30%">
                    <el-form :model="addAct">
                        <el-form-item label="退货单去向" label-width="100px">
                            <el-select v-model="addAct.retreat" filterable placeholder="请选择退货单去向(必)" size="small" class="panType" style="width:95%">
                                <el-option v-for="item in opt" :key="item.value" :label="item.label" :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="showBox = false" size="small">取 消</el-button>
                        <el-button type="primary" @click="sureBtn" size="small">确 定</el-button>
                    </div>
                </el-dialog>
                <el-dialog title="退货仓库信息" :visible.sync="showCang" class="add-box" width="30%">
                    <el-form :model="sendAct">
                        <el-form-item label="退货仓库" label-width="100px">
                            <el-select v-model="sendAct.factory_type" filterable placeholder="请选择退货仓库(必)" size="small" class="panType" style="width:95%">
                                <el-option v-for="item in options1" :key="item.id" :label="item.type" :value="item.id"></el-option>
                            </el-select>
                        </el-form-item>
                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="showCang = false" size="small">取 消</el-button>
                        <el-button type="primary" @click="sureCang" size="small">确 定</el-button>
                    </div>
                </el-dialog>
                <el-dialog title="转退货单详情" :visible.sync="showTb" class="add-box" width="80%">
                    <el-form :model="addAct">
                        <el-table :data="editTB" class="tb-edit" size="mini" border style="margin-top:20px;" max-height="565" highlight-current-row :span-method="objectSpanMethod">
                            <el-table-column prop="girard" label="款号" min-width="90" :resizable='false'></el-table-column>
                            <el-table-column prop="color" label="颜色" min-width="80" :resizable='false'></el-table-column>
                            <el-table-column prop="type" label="类别" min-width="90" :resizable='false'></el-table-column>


                            <el-table-column v-for="(item,index) in sizeGr"  :label="item.key76" width="70" :resizable='false'>
                                <el-table-column :label="item.key75" width="70" :resizable='false'>
                                    <el-table-column :label="item.key79" width="70" :resizable='false'>
                                        <el-table-column :label="item.key154" width="70" :resizable='false'>
                                            <el-table-column :label="item.key146" width="70" :resizable='false'>
                                                <el-table-column :label="item.key161" width="70" :resizable='false'>
                                                    <el-table-column :label="item.key77" width="70" :resizable='false'>
                                                        <el-table-column :prop="item.key_0" :label="item.key140" width="70" :resizable='false'>
                                                            <template slot-scope="scope">
                                                                <span v-if="item.key_0==='size_group'">
                                                                    @{{scope["row"][item["key_0"]] }}
                                                                </span>
                                                                <span v-else>
                                                                    <span v-if="scope.row.type==='退货已分配'">
                                                                        <span v-if="index<=scope.row.num.length">
                                                                            <el-input size="small" v-model="scope['row']['num'][index-1]" @keyup.native="keyUp(scope['row']['num'][index-1],scope)"></el-input>
                                                                            <span style="color:#1aad1a; ">@{{scope['row']['num'][index-1]}}</span>
                                                                        </span>
                                                                    </span>
                                                                    <span v-else-if="scope.row.type=='退货需求'">
                                                                        <span v-if="index<=scope.row.num.length">
                                                                            <span style="color:orange;">@{{ getUseing(scope) }}</span>
                                                                        </span>
                                                                    </span>
                                                                </span>
                                                            </template>
                                                        </el-table-column>
                                                    </el-table-column>
                                                </el-table-column>
                                            </el-table-column>
                                        </el-table-column>
                                    </el-table-column>
                                </el-table-column>
                            </el-table-column>

                            <el-table-column prop="count" label="合计/件" width="70" :resizable='false'>
                                <template slot-scope="scope">
                                    <span>@{{ totalCount(scope) }}</span>
                                </template>
                            </el-table-column>
                            <el-table-column prop="price" label="吊牌价/元" align="right" width="120" :resizable='false'></el-table-column>
                            <el-table-column prop="cardCount" label="吊牌金额/元" align="right" width="130" :resizable='false'>
                                <template slot-scope="scope">
                                    <span>@{{ diaoCount(scope) }}</span>
                                </template>
                            </el-table-column>
                        </el-table>
                        {{--<br>数据:@{{editTB}}--}}

                    </el-form>
                    <div slot="footer" class="dialog-footer">
                        <el-button @click="showTb = false" size="small">取 消</el-button>
                        <el-button type="primary" @click="dateBtn" size="small">确 定</el-button>
                    </div>
                </el-dialog>
            </div>
        </div>
        <!-- /主体-->
    </div>

    <script>
        new Vue({
            el: '#guanLi',
            data:{
                sizeGr:[],//尺码信息
                options1: [],//发货仓库
                //汇总
                total_nums:'',//数量
                turn_nums:'',//已转单数
                total_price:'',//总金额

                tableInfo:[], //表单数据
                tbInfo:[],//详细表单数据
                total:1,  //table总条数
                currentPage:1, //table当前页数
                page:10,//每页多少条
                ids:'',//多选框id拼起来

                //搜索
                order_num:'',//单据号
                girard:'',//款号
                customer:'',//客户
                status:'',//审核状态
                is_ack:'',//单据运行状态
                season_type:[],//销售季节数据
                sale_season:'',//销售季节
                type:'',//退货单去向

                //验证数据用
                disArr:[],//审核状态数组
                ackArr:[],//单据运行状态数组
                tyArr:[],//退货单去向数组
                loading:false,

                showBox:false,//添加弹框显示隐藏
                addAct:{
                    retreat:'',//补货申请单去向
                },
                showCang:false,
                sendAct:{
                    factory_type:'',//发货仓库
                },
                opt: [{
                    label:'向上级提交退货申请单',
                    value:1,
                },{
                    label:'下级提交退货申请单',
                    value:-1,
                }], //退货申请单去向数组

                //转退货单数据
                showTb:false,
                sel: null,//选中行
                count: 0,
                editTB:[

                ],
                kuNum:[],//库存数组
                fenNum:[],//已分配数组

                cou1:'',//判断转退货单
                cou2:'',

                sureMakeFlag:true,
                offMakeFlag:true,
                auditCardFlag:true,
                versaFlag:true,
                delDisFlag:true,
                boHuiFlag:true,
            },
            created(){
                this.loading=true;
            },
            mounted(){
                this.common();
                this.grabble();
                this.baseIn();
            },
            computed: { //计算属性
                //合计
                totalCount() {
                    return function(scope){
                        //console.log(scope)
                        let cvs=0;
                        let scpArr=scope.row.num;

                        for(var cv=0;cv<scpArr.length;cv++){
                            if(scpArr[cv]==''){
                                scpArr[cv]=0;
                            }
                            cvs+=Number(scpArr[cv]);
                        }
                        scope.row.count=cvs;
                        //console.log(cvs)
                        return cvs
                    }
                },
                //吊牌总额
                diaoCount(){
                    return function(scope){
                        let scpArr=scope.row.num;//数量
                        let count=scope.row.count;//合计
                        let money=scope.row.price;//吊牌价
                        let oneNum=0;
                        let twoNum=0;
                        if(scpArr.length==9 && money.indexOf("/")!=-1) {
                            for (var cc = 0; cc < scpArr.length; cc++) {
                                if (scpArr[cc] == '') {
                                    scpArr[cc] = 0;
                                }
                                if (cc < 7) {
                                    oneNum += Number(scpArr[cc]);
                                } else {
                                    twoNum += Number(scpArr[cc]);
                                }
                            }
                        }
                        if(money.indexOf("/")!=-1){
                            let priArr=money.split("/");
                            let disOne=priArr[0]*oneNum;
                            let disTwo=priArr[1]*twoNum;
                            return (disOne+disTwo).toFixed(2);
                        }else{
                            return (money*count).toFixed(2);
                        }
                    }
                },
                //可用退货需求变动
                getUseing() {
                    return function(scope){
                        // 找到loop相同的退货需求的数据
                        let sameData = this.editTB.find((n) => n.loop == scope.row.loop && n.type == '退货已分配');
                        // 找到当前 prop 名
                        let num_index = scope.column.property.replace(/[^0-9]/ig,"");
                        // 找到当前尺码剩余的退货需求
                        let now_has_storage = scope.row.now_has_storage[num_index];
                        // 找到当前尺码的退货需求
                        let order_distribution = sameData.num[num_index];

                        scope.row.num[num_index] = (now_has_storage - order_distribution);

                        return now_has_storage - order_distribution;
                    };

                },
            },
            methods:{
                //键盘按下事件
                keyUp(val,scope){
                    //console.log(scope.row.loop);
                    // 找到loop相同的可用库存
                    let saDa = this.editTB.find((n) => n.loop == scope.row.loop && n.type == '退货需求');
                    // 找到当前 prop 名
                    let kuIndex = scope.column.property.replace(/[^0-9]/ig,"");
                    // 找到当前尺码的可用库存
                    let kuNum = saDa.now_has_storage[kuIndex];


                    if(Number(kuNum)-Number(val)<0 ){
                        this.$notify.error({
                            title: '提示',
                            message: "退货已分配不能大于退货需求",
                        });
                        scope.row.num[kuIndex] = 0;
                        this.$set(this.editTB,scope.$index,scope.row);
                        return false;
                    }
                    var reg=/^([1-9]\d*|[0]{1,1})$/;
                    if(!reg.test(val)){
                        this.$notify.error({
                            title: '提示',
                            message: "请填写大于等于0的正整数",
                        });
                        scope.row.num[kuIndex] = 0;
                        this.$set(this.editTB,scope.$index,scope.row);
                        return false;
                    }
                },
                /*尺码数据*/
                common(){
                    var that=this;
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/sizeGroupHead',
                        data: {
                            type:1,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.sizeGr=data.content.vertical;
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
                /*搜索下拉框*/
                baseIn(){
                    var that=this;
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/extra-infos',
                        data: {
                            type:1,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.options1=data.content.factory_type;
                                var st2=[];
                                for(var value of data.content.sale_season){
                                    st2.push({
                                        'text':value.season,
                                        'value':value.id,
                                    })
                                }
                                that.season_type=st2;
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
                //获取数据
                grabble(type){
                    var that = this;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/wholesale-return-repl-list',
                        data: {
                            skip:skip,
                            page:that.page,
                            order_num:that.order_num,
                            girard:that.girard,
                            customer:that.customer,
                            status:that.status,
                            is_ack:that.is_ack,
                            sale_season:that.sale_season,
                            type:that.type,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.total_nums=data.content.total_nums;
                                that.total_price=parseFloat(data.content.total_price).toFixed(2);
                                that.turn_nums=data.content.turn_nums;
                                var opt=[];
                                let i = 0;
                                for(var value of data.content.data){
                                    i++;
                                    opt.push({
                                        'id':value.id,
                                        'loop':i+(Number(that.page)*skip),
                                        'order_num':value.order_num,
                                        'customer':value.customer,
                                        'del_auth':value.del_auth,
                                        'nums':value.nums,
                                        'type':value.type,
                                        'turn_nums':value.turn_nums,
                                        'total_price': parseFloat( value.total_price ).toFixed(2),
                                        'status':value.status,
                                        'is_ack':value.is_ack,
                                        'sale_season':value.sale_season,
                                        'created_at':value.created_at,
                                        'founder':value.founder,
                                        'check_time':value.check_time,
                                        'checker':value.checker,
                                        'ack_time':value.ack_time,
                                        'acker':value.acker,
                                        'last_modified':value.last_modified,
                                        'last_modified_time':value.last_modified_time,
                                        'remark':value.remark,
                                        "bgColor":that.getBgType(value.status,value.is_ack)
                                    })
                                }
                                that.tableInfo = opt;
                                that.currentPage = parseFloat( data.content.skip );
                                that.total = data.content.total_count;
                                that.loading=false
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*重置*/
                resetFrom(){
                    this.order_num='';
                    this.girard='';
                    this.customer='';
                    this.status='';
                    this.is_ack='';
                    this.sale_season='';
                    this.grabble('reset')
                },
                changePageSkip(val){
                    //console.log(`当前页: ${val}`);
                    this.currentPage = val;
                    this.grabble();
                },
                handleSizeChange(val) {
                    this.page=val;
                    this.grabble('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*状态搜索*/
                filterChange(filters){
                    //console.log(filters)
                    if(filters.status!=undefined){
                        var fil=filters.status;
                        var stas1='';
                        for(let d=0;d<fil.length; d++){
                            stas1=stas1+fil[d]+',';
                        }
                        this.status=stas1.substr(0, stas1.length - 1);
                        this.grabble('reset');
                    }
                    if(filters.is_ack!=undefined){
                        var typeArr=filters.is_ack;
                        var stas2='';
                        for(let x=0;x<typeArr.length; x++){
                            stas2=stas2+typeArr[x]+',';
                        }
                        this.is_ack=stas2.substr(0, stas2.length - 1);
                        this.grabble('reset');
                    }
                    if(filters.sale_season!=undefined){
                        var saleArr=filters.sale_season;
                        var stas4='';
                        for(let x=0;x<saleArr.length; x++){
                            stas4=stas4+saleArr[x]+',';
                        }
                        this.sale_season=stas4.substr(0, stas4.length - 1);
                        this.grabble('reset');
                    }
                    if(filters.type!=undefined){
                        var typeArr=filters.type;
                        var stas5='';
                        for(let x=0;x<typeArr.length; x++){
                            stas5=stas5+typeArr[x]+',';
                        }
                        this.type=stas5.substr(0, stas5.length - 1);
                        this.grabble('reset');
                    }
                },
                /*制单*/
                touching(){
                    this.showBox = true;
                    this.addAct.retreat='';
                },
                /*点击制单确定*/
                sureBtn(){
                    var that = this;
                    if(that.addAct.retreat==''){
                        this.$notify.error({
                            title: '提示',
                            message: '请选择退货单去向',
                        });
                        return false;
                    }
                    $.ajax({
                        headers: {'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')},
                        type: 'post',
                        url: '/distribution/create-return-repl',
                        data: {
                            type:that.addAct.retreat,
                        },
                        success: function (data) {
                            if(data.result.success){
                                window.location.href='/distribution/return-repl-details/'+data.content+'?is_modify=0';
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*多选*/
                handleSelectionChange(val){
                    if(val.length>0){
                        var st='';
                        this.disArr=[];
                        this.ackArr=[];
                        this.tyArr=[];
                        for(var value of val){
                            st=st+value.id+',';
                            this.disArr.push(value.status);
                            this.ackArr.push(value.is_ack);
                            this.tyArr.push(value.type);
                            this.cou1=value.nums;
                            this.cou2=value.turn_nums;
                        }
                        this.ids=st.substr(0, st.length - 1);
                    }else{
                        this.ids='';
                        this.disArr=[];
                        this.ackArr=[];
                        this.tyArr=[];
                    }
                    //console.log(this.ids);
                    //console.log(this.disArr);
                    //console.log(this.ackArr);
                    console.log(this.tyArr);
                },
                /*确认制单*/
                sureMake(){
                    var arrs=this.ackArr;
                    for(let n=0;n<arrs.length;n++){
                        if(arrs[n]!=0){
                            this.$notify.error({
                                title: '提示',
                                message: "不能重复操作已确认的单据",
                            });
                            return false;
                        }
                    }
                    var that=this;
                    if(that.ids==''){
                        this.$notify.error({
                            title: '提示',
                            message: "至少选择一项确认制单",
                        });
                        return false;
                    }
                    const h = this.$createElement;
                    this.$msgbox({
                        title: '提示',
                        message: h('p', null, [
                            h('span', null, '是否确认制单?'),
                        ]),
                        showCancelButton: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        beforeClose: (action, instance, done) => {
                            if (action === 'confirm') {
                                if(that.sureMakeFlag==true){
                                    that.sureMakeFlag=false;
                                    $.ajax({
                                        headers: {
                                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                                        },
                                        type: 'post',
                                        url: '/distribution/return-repl-order-ack',
                                        data: {
                                            ids:that.ids
                                        },
                                        success: function (data) {
                                            //console.log(data);
                                            if(data.result.success){
                                                that.$notify.success({
                                                    title: '提示',
                                                    message: "确认制单成功"
                                                });
                                                done();
                                                that.grabble('reset');
                                                that.sureMakeFlag=true;
                                            }else{
                                                that.$notify.error({
                                                    title: '错误',
                                                    message: data.result.errorMsg
                                                });
                                                that.sureMakeFlag=true;
                                            }
                                        }
                                    })
                                }
                            } else {
                                done();
                            }
                        }
                    }).then(action => {

                    });
                },
                /*反确认*/
                offMake(){
                    var arrs2=this.ackArr;
                    for(let m=0;m<arrs2.length;m++){
                        if(arrs2[m]!=1){
                            this.$notify.error({
                                title: '提示',
                                message: "请先确认制单再反确认",
                            });
                            return false;
                        }
                    }
                    var arrs3=this.disArr;
                    for(let z=0;z<arrs3.length;z++){
                        if(arrs3[z]!=1){
                            this.$notify.error({
                                title: '提示',
                                message: "已审核单据不能反确认，请先反审",
                            });
                            return false;
                        }
                    }
                    var that=this;
                    if(that.ids==''){
                        this.$notify.error({
                            title: '提示',
                            message: "至少选择一项反确认",
                        });
                        return false;
                    }
                    const h = this.$createElement;
                    this.$msgbox({
                        title: '提示',
                        message: h('p', null, [
                            h('span', null, '是否反确认制单?'),
                        ]),
                        showCancelButton: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        beforeClose: (action, instance, done) => {
                            if (action === 'confirm') {
                                if(that.offMakeFlag==true){
                                    that.offMakeFlag=false;
                                    $.ajax({
                                        headers: {
                                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                                        },
                                        type: 'post',
                                        url: '/distribution/return-repl-order-anti-ack',
                                        data: {
                                            ids:that.ids
                                        },
                                        success: function (data) {
                                            //console.log(data);
                                            if(data.result.success){
                                                that.$notify.success({
                                                    title: '提示',
                                                    message: "反确认成功"
                                                });
                                                done();
                                                that.grabble('reset');
                                                that.offMakeFlag=true;
                                            }else{
                                                that.$notify.error({
                                                    title: '错误',
                                                    message: data.result.errorMsg
                                                });
                                                that.offMakeFlag=true;
                                            }
                                        }
                                    })
                                }
                            } else {
                                done();
                            }
                        }
                    }).then(action => {

                    });
                },
                /*审核*/
                auditCard(){
                    var arrs2=this.ackArr;
                    for(let m=0;m<arrs2.length;m++){
                        if(arrs2[m]!=1){
                            this.$notify.error({
                                title: '提示',
                                message: "请先确认制单再审核",
                            });
                            return false;
                        }
                    }
                    var arrs3=this.disArr;
                    for(let z=0;z<arrs3.length;z++){
                        if(arrs3[z]!=1){
                            this.$notify.error({
                                title: '提示',
                                message: "已审核单据不能重复审核",
                            });
                            return false;
                        }
                    }
                    var that=this;
                    if(that.ids==''){
                        this.$notify.error({
                            title: '提示',
                            message: "至少选择一项审核",
                        });
                        return false;
                    }
                    const h = this.$createElement;
                    this.$msgbox({
                        title: '提示',
                        message: h('p', null, [
                            h('span', null, '是否确认审核?'),
                        ]),
                        showCancelButton: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        beforeClose: (action, instance, done) => {
                            if (action === 'confirm') {
                                if(that.auditCardFlag==true){
                                    that.auditCardFlag=false;
                                    $.ajax({
                                        headers: {
                                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                                        },
                                        type: 'post',
                                        url: '/distribution/return-repl-order-review',
                                        data: {
                                            ids:that.ids
                                        },
                                        success: function (data) {
                                            //console.log(data);
                                            if(data.result.success){
                                                that.$notify.success({
                                                    title: '提示',
                                                    message: "审核成功"
                                                });
                                                done();
                                                that.grabble('reset');
                                                that.auditCardFlag=true;
                                            }else{
                                                that.$notify.error({
                                                    title: '错误',
                                                    message: data.result.errorMsg
                                                });
                                                that.auditCardFlag=true;
                                            }
                                        }
                                    })
                                }
                            } else {
                                done();
                            }
                        }
                    }).then(action => {

                    });
                },
                /*反审*/
                versa(){
                    var arrs4=this.disArr;
                    for(let zx=0;zx<arrs4.length;zx++){
                        if(arrs4[zx]!=2){
                            this.$notify.error({
                                title: '提示',
                                message: "未审核单据不能反审",
                            });
                            return false;
                        }
                    }

                    var that=this;
                    if(that.ids==''){
                        this.$notify.error({
                            title: '提示',
                            message: "至少选择一项反审",
                        });
                        return false;
                    }
                    const h = this.$createElement;
                    this.$msgbox({
                        title: '提示',
                        message: h('p', null, [
                            h('span', null, '是否确认反审?'),
                        ]),
                        showCancelButton: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        beforeClose: (action, instance, done) => {
                            if (action === 'confirm') {
                                if(that.versaFlag==true){
                                    that.versaFlag=false;
                                    $.ajax({
                                        headers: {
                                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                                        },
                                        type: 'post',
                                        url: '/distribution/return-repl-order-anti-review',
                                        data: {
                                            ids:that.ids
                                        },
                                        success: function (data) {
                                            //console.log(data);
                                            if(data.result.success){
                                                that.$notify.success({
                                                    title: '提示',
                                                    message: "反审成功"
                                                });
                                                done();
                                                that.grabble('reset');
                                                that.versaFlag=true;
                                            }else{
                                                that.$notify.error({
                                                    title: '错误',
                                                    message: data.result.errorMsg
                                                });
                                                that.versaFlag=true;
                                            }
                                        }
                                    })
                                }
                            } else {
                                done();
                            }
                        }
                    }).then(action => {

                    });
                },
                /*删除*/
                delDis(scope){
                    var that=this;
                    const h = this.$createElement;
                    this.$msgbox({
                        title: '提示',
                        message: h('p', null, [
                            h('span', null, '是否确认删除该单据?'),
                        ]),
                        showCancelButton: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        beforeClose: (action, instance, done) => {
                            if (action === 'confirm') {
                                if(that.delDisFlag==true){
                                    that.delDisFlag=false;
                                    $.ajax({
                                        headers: {
                                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                                        },
                                        type: 'post',
                                        url: '/distribution/return-repl-order-del',
                                        data: {
                                            id:scope.row.id,
                                        },
                                        success: function (data) {
                                            //console.log(data);
                                            if(data.result.success){
                                                that.$notify.success({
                                                    title: '提示',
                                                    message: "删除成功"
                                                });
                                                done();
                                                that.grabble('reset');
                                                that.delDisFlag=true;
                                            }else{
                                                that.$notify.error({
                                                    title: '错误',
                                                    message: data.result.errorMsg
                                                });
                                                that.delDisFlag=true;
                                            }
                                        }
                                    })
                                }
                            } else {
                                done();
                            }
                        }
                    }).then(action => {

                    });
                },
                /*修改*/
                editDis(scope){
                    window.location.href='/distribution/return-repl-details/'+scope.row.id+'?is_modify=1';
                },
                /*查看*/
                lookDis(scope){
                    window.location.href='/distribution/return-repl-details/'+scope.row.id+'?is_modify=0';
                },
                /*驳回*/
                boHui(){
                    var that=this;
                    if(that.ids==''){
                        this.$notify.error({
                            title: '提示',
                            message: "至少选择一项驳回",
                        });
                        return false;
                    }
                    var arrs3=this.disArr;
                    for(let z=0;z<arrs3.length;z++){
                        if(arrs3[z]!=1){
                            this.$notify.error({
                                title: '提示',
                                message: "已审核单据不能驳回",
                            });
                            return false;
                        }
                    }
//                    var arrs4=this.tyArr;
//                    for(let z=0;z<arrs4.length;z++){
//                        if(arrs4[z]!=-1){
//                            this.$notify.error({
//                                title: '提示',
//                                message: "只能驳回下级提交的单据",
//                            });
//                            return false;
//                        }
//                    }
                    const h = this.$createElement;
                    this.$msgbox({
                        title: '提示',
                        message: h('p', null, [
                            h('span', null, '是否确认驳回?'),
                        ]),
                        showCancelButton: true,
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        beforeClose: (action, instance, done) => {
                            if (action === 'confirm') {
                                if(that.boHuiFlag==true){
                                    that.boHuiFlag=false;
                                    $.ajax({
                                        headers: {
                                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                                        },
                                        type: 'post',
                                        url: '/distribution/return-repl-turn-down',
                                        data: {
                                            ids:that.ids
                                        },
                                        success: function (data) {
                                            //console.log(data);
                                            if(data.result.success){
                                                that.$notify.success({
                                                    title: '提示',
                                                    message: "驳回成功"
                                                });
                                                done();
                                                that.grabble('reset');
                                                that.boHuiFlag=true;
                                            }else{
                                                that.$notify.error({
                                                    title: '错误',
                                                    message: data.result.errorMsg
                                                });
                                                that.boHuiFlag=true;
                                            }
                                        }
                                    })
                                }
                            } else {
                                done();
                            }
                        }
                    }).then(action => {

                    });
                },
                /*背景颜色*/
                tableRowClassName({row, rowIndex}){
                    if(row.bgColor == ''){
                        return ""
                    }else if(row.bgColor == 'bgBlue'){
                        return "bgBlue"
                    }else if(row.bgColor == 'bgred'){
                        return "bgred"
                    }
                    return ''
                },
                getBgType(status,is_ack){
                    if(is_ack == 0 && status==1){
                        return ""
                    }else if(is_ack == 1 && status==1){
                        return "bgBlue"
                    }else if(is_ack == 1 && status==2){
                        return "bgred"
                    }
                    return ''
                },
                /*点击出详情*/
                rowClick(row, event, column) {
                    var that=this;
                    /*当事件源是a的时候，我们不展开*/
                    let nodeName = event.target.nodeName;
                    if(nodeName==='BUTTON'){
                        return;
                    }
                    if(nodeName==='SPAN'){
                        return;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/return-repl-turn-detail',
                        data: {
                            id:row.id
                        },
                        success: function (data) {
                            console.log(data);
                            if(data.result.success){

                                var opt=[];
                                for(var value of data.content){
                                    console.log(value.num)
                                    var cvs=0;
                                    for(var cv=0;cv<value.num.length;cv++){
                                        if(value.num[cv]==''){
                                            value.num[cv]=0;
                                        }
                                        cvs+=Number(value.num[cv]);
                                    }
                                    var oneNum=0;
                                    var twoNum=0;
                                    if(value.num.length==9 && value.price.indexOf("/")!=-1){
                                        for(var cc=0;cc<value.num.length;cc++){
                                            if(value.num[cc]==''){
                                                value.num[cc]=0;
                                            }
                                            if(cc<7){
                                                oneNum+=Number(value.num[cc]);
                                            }else{
                                                twoNum+=Number(value.num[cc]);
                                            }
                                        }
                                    }
                                    opt.push({
                                        'girard':value.girard,
                                        'color':value.color,
                                        'type':value.type,
                                        'num':value.num,
                                        'count':cvs,
                                        'price':value.price,
                                        'discount':value.discount,
                                        'size_group':value.size_group,
                                        'cardCount':that.getCou(value.price , oneNum , twoNum , cvs),
                                    })
                                }
                                that.tbInfo = opt;
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
                /*折扣价*/
                getMon(money,dis){
                    if(money.indexOf("/")!=-1 && dis.indexOf("/")!=-1){
                        let priArr=money.split("/");
                        let disArr=dis.split("/");
                        let disPriOne=(priArr[0]*disArr[0]).toFixed(2);
                        let disPriTwo=(priArr[1]*disArr[1]).toFixed(2);
                        return disPriOne+'/'+disPriTwo
                    }else if(money.indexOf("/")!=-1 && dis.indexOf("/")==-1){
                        let priArr=money.split("/");
                        let disPriOne=(priArr[0]*dis).toFixed(2);
                        let disPriTwo=(priArr[1]*dis).toFixed(2);
                        return disPriOne+'/'+disPriTwo
                    }else if(money.indexOf("/")==-1 && dis.indexOf("/")!=-1){
                        let disArr=dis.split("/");
                        let disPriOne=(money*disArr[0]).toFixed(2);
                        let disPriTwo=(money*disArr[1]).toFixed(2);
                        return disPriOne+'/'+disPriTwo
                    }else{
                        return (money*dis).toFixed(2);
                    }
                },
                /*总折扣金额*/
                getDon(money,dis,n1,n2,n3){
                    if(money.indexOf("/")!=-1 && dis.indexOf("/")!=-1){
                        let priArr=money.split("/");
                        let disArr=dis.split("/");
                        let disPriOne=(priArr[0]*disArr[0]*n1);
                        let disPriTwo=(priArr[1]*disArr[1]*n2);
                        return (Number(disPriOne) + Number(disPriTwo)).toFixed(2);
                    }else if(money.indexOf("/")!=-1 && dis.indexOf("/")==-1){
                        let priArr=money.split("/");
                        let disPriOne=(priArr[0]*dis*n1);
                        let disPriTwo=(priArr[1]*dis*n2);
                        return (Number(disPriOne) + Number(disPriTwo)).toFixed(2);
                    }else if(money.indexOf("/")==-1 && dis.indexOf("/")!=-1){
                        let disArr=dis.split("/");
                        let disPriOne=(money*disArr[0]*n1);
                        let disPriTwo=(money*disArr[1]*n2);
                        return (Number(disPriOne) + Number(disPriTwo)).toFixed(2);
                    }else{
                        return (money*dis*n3).toFixed(2);
                    }
                },
                /*总吊牌金额*/
                getCou(money,n1,n2,n3){
                    if(money.indexOf("/")!=-1){
                        let priArr=money.split("/");
                        let disPriOne=(priArr[0]*n1);
                        let disPriTwo=(priArr[1]*n2);
                        return (Number(disPriOne) + Number(disPriTwo)).toFixed(2);
                    }else{
                        return (money*n3).toFixed(2);
                    }
                },
                /*转退货单*/
                zhuanCard(){
                    var that=this;
                    var arrs4=this.disArr;
                    for(let zx=0;zx<arrs4.length;zx++){
                        if(arrs4[zx]!=2){
                            this.$notify.error({
                                title: '提示',
                                message: "未审核单据不能转退货单",
                            });
                            return false;
                        }
                    }
                    if(that.ids==''){
                        this.$notify.error({
                            title: '提示',
                            message: "请选择一项转退货单",
                        });
                        return false;
                    }
                    if(that.ids.split(",").length>1){
                        this.$notify.error({
                            title: '提示',
                            message: "请选择一项转退货单",
                        });
                        return false;
                    }
                    if(Number(that.cou1)-Number(that.cou2)<=0 && that.cou1!=0){
                        this.$notify.error({
                            title: '提示',
                            message: "该单据已全部转完销售单，不能再转",
                        });
                        return false;
                    }
                    that.sendAct.factory_type='';
                    that.showCang=true;
                },
                //转退货单确定
                sureCang(){
                    var that=this;
                    if(that.sendAct.factory_type==''){
                        that.$notify.error({
                            title: '错误',
                            message: "请选择退货仓库"
                        });
                        return false;

                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/return-repl-distribution',
                        data: {
                            id:that.ids,
                            factory_type:that.sendAct.factory_type,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.editTB=data.content;
                                // 先把所有退货需求，退货已分配都存下来 免得后面改动数据就不知道实际是多少了
                                for(let value of data.content){
                                    if(value.type == '退货需求'){
                                        value['now_has_storage'] = [...value.num]
                                    }
                                    if(value.type == '退货已分配'){
                                        value['order_need'] = [...value.num]
                                    }
                                }

                                that.showTb=true;
                                that.showCang=false;
                            }else{
                                that.$notify.error({
                                    title: '错误',
                                    message: data.result.errorMsg
                                });
                            }
                        }
                    })
                },
                //提交数据
                dateBtn(){
                    var that=this;
                    let json=[];
                    console.log(this.editTB)
                    for(let h of this.editTB){
                        if(h.type=='退货已分配'){
                            json.push({girard:h.girard,color:h.color,num:h.num,size:h.size});
                        }
                    }
                    $(".tb-edit .current-row .el-input").css({"display":"none"});
                    $(".tb-edit .current-row .el-input+span").css({"display":"block"});
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/return-repl-transfer',
                        data: {
                            id:that.ids,
                            factory_type:that.sendAct.factory_type,
                            data:JSON.stringify(json),
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.$notify.success({
                                    title: '提示',
                                    message: "操作成功"
                                });
                                that.showTb=false;
                                that.editTB=[];
                                that.grabble();
                            }else{
                                that.$notify.error({
                                    title: '错误',
                                    message: data.result.errorMsg
                                });
                            }
                        }
                    })


                },
                /*操作页合并单元格*/
                objectSpanMethod({ row, column, rowIndex, columnIndex }) {
                    if (columnIndex ===  0 || columnIndex ===  1) {
                        // 合并第一列
                        if (rowIndex % 2 === 0) {
                            // 从第一行开始
                            return {
                                rowspan: 2,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                },
                /*展示页合并单元格*/
                SpanMethod({ row, column, rowIndex, columnIndex }){
                    if (columnIndex ===  0 || columnIndex ===  1) {
                        // 合并第一列
                        if (rowIndex % 2 === 0) {
                            // 从第一行开始
                            return {
                                rowspan: 2,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                },
            },
        });
    </script>
@endsection